/* 生成一个200以内的随机数，猜这个随机数是多少 */

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int main()
{
    /*生成随机数种子*/
    srand(time(NULL));

    int randomNum = rand() % 200;

    printf("randomNum = %d\n", randomNum);

    int num, min = 0, max = 200;
    printf("请输入一个数：");
    scanf("%d", &num);
    //printf("num = %d\n", num);

    while (num)
    {
        if (num > randomNum)
        {
            printf("大了\n");
            printf("在%d ~ %d之间\n", min, num);
            max = num;
            scanf("%d", &num);
        }
        if (num < randomNum)
        {
            printf("小了\n");
            printf("在%d ~ %d之间\n", num, max);
            min = num;
            scanf("%d", &num);
        }
        if (num == randomNum)
        {
            printf("正确\n");
            break;
        }
    }
    return 0;
}